package com.ch.pagedemo.bean

class Movie {

    var id: Int = 0
    var title: String
    var cover: String
    var rate: String


    constructor(title: String, cover: String, rate: String) {
        this.title = title
        this.cover = cover
        this.rate = rate
    }

    constructor(id: Int, title: String, rate: String, cover: String) {
        this.id = id
        this.title = title
        this.rate = rate
        this.cover = cover
    }

    override fun toString(): String {
        return "Movie(id=$id, title=$title, rate=$rate, cover=$cover)"
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as Movie

        if (id != other.id) return false
        if (title != other.title) return false
        if (rate != other.rate) return false
        if (cover != other.cover) return false

        return true
    }

    override fun hashCode(): Int {
        var result = id
        result = 31 * result + (title?.hashCode() ?: 0)
        result = 31 * result + (rate?.hashCode() ?: 0)
        result = 31 * result + (cover?.hashCode() ?: 0)
        return result
    }


}